<?php
$app = Blyn::app()->getActiveApp();
?>
<link rel="stylesheet" type="text/css"
      href="<?php echo Yii::app()->request->baseUrl; ?>/css/bootstrap-datetimepicker.min.css" />
<script  type="text/javascript"
         src="<?php echo Yii::app()->request->baseUrl; ?>/js/bootstrap-datetimepicker.min.js"/>

<script type="text/javascript">
    $(function() {
        $("#checkAll_2").click(function() {
            $('input[name="subBox"]').attr("checked", this.checked);
        });
        var $subBox = $("input[name='subBox']");
        $subBox.click(function() {
            $("#checkAll").attr("checked", $subBox.length == $("input[name='subBox']:checked").length ? true : false);
        });
    });</script>
<script type="text/javascript">
    $(function() {
        $('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch');
        $('.tree li.parent_li > span').on('click', function(e) {
            var children = $(this).parent('li.parent_li').find(' > ul > li');
            if (children.is(":visible")) {
                children.hide('fast');
                $(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
            } else {
                children.show('fast');
                $(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
            }
            e.stopPropagation();
        });
    });</script>
<script type="text/javascript">
    $(function() {
        $("#Event_Shop_CX").click(function() {
            document.getElementById("Event_Shop_CX_View").style.display = '';
            document.getElementById("Event_Clothes_CX_View").style.display = 'none';
        });
        $("#Event_Clothes_CX").click(function() {
            document.getElementById("Event_Shop_CX_View").style.display = 'none';
            document.getElementById("Event_Clothes_CX_View").style.display = '';
        });
    });</script>

<?php
$form = $this->beginWidget('CActiveForm', array(
    "id" => "find_event_list",
    'enableAjaxValidation' => FALSE,
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
        ));
$model = new BDynamicFormModel();
$model->addField('findText');
$model->addField('findType');
?>
<form class="form-inline">
    <?php
    echo $form->textField($model, 'findText', array('placeholder' => 'find text...', 'class' => 'input-medium'));
    ?>      
    <?php
    echo $form->dropDownList($model, 'findType', array('1' => '地点搜索', '2' => '关键字搜索'), array('class' => 'span2'));
    ?>
    <button type="submit" class="btn">Search</button>
</form>
<?php $this->endWidget(); ?>

<div><legend>预订项列表</legend></div>

<fieldset>
    <table class="table table-hover">
        <thead>
            <tr>
                <th>
                    <input type="checkbox" name="checkAll_2" id="checkAll_2"> 
                </th>
                <th>活动名称</th>
                <th>活动类型</th>
                <th>开始时间</th>
                <th>结束时间</th>
                <th>操作</th>
            </tr> 
        </thead>
        <tbody>
            <?php foreach ($eventList as $event) { ?>
                <tr>
                    <td><label class="checkbox">
                            <input type="checkbox" name="subBox[]" value="<?php echo $event->id; ?>"> 
                        </label></td>
                    <td> <?php echo $event->getName(); ?> </td>
                    <td> <?php echo $event->getType()->getFullName('|'); ?> </td>
                    <td> <?php echo $event->startTime; ?> </td>
                    <td> <?php echo $event->endTime; ?> </td>
                    <td>
                        <div class="row-fluid">                         
                            <?php
                            echo $control->getAjaxLink(array('name' => '修改', 'id' => 'showAddEvent'), array(
                                'eventId' => $event->id,
                                'htmlOptions' => array(
                                    'enctype' => 'multipart/form-data')                              
                            ));
                            ?>                             
                        </div>                      
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </table>

    <div class="row-fluid">
        <?php
        echo $control->getAjaxLink(array('name' => '新增', 'id' => 'showAddEvent'), array(
            'eventId' => 0,
            'htmlOptions' => array(
                'enctype' => 'multipart/form-data',
                'class' => 'btn')
        ));
        ?>
        <?php
        echo $control->getAjaxLink(array('name' => '删除', 'id' => 'deleteEvent'), array(
            'htmlOptions' => array(
                'class' => 'btn',
                'enctype' => 'multipart/form-data')));
        ?>
    </div>   

    <div><input type="hidden" name="curPageNo" value="1"></div>

    <div class="pagination">  
        <ul>  
            <li class="active">
                <a href="javascript:void()">前一页</a>    </li>  
            <li class="active">
                <a href="javascript:void()">1</a>    </li>  
            <li class="active">
                <a href="javascript:void()">后一页</a>    </li>  
        </ul>  
    </div>


